package com.huilian.iotbox.data.enums;

import lombok.Getter;

import java.util.stream.Stream;

/**
 * 终端权限类型
 */
@Getter
public enum PermissionStatusEnum {
    OPEN(1, "上架"),
    CLOSE(0, "下架"),;

    private Integer code;
    private String desc;

    PermissionStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PermissionStatusEnum getPlatformType(Integer code) {
        return Stream.of(PermissionStatusEnum.values())
                .filter(p -> p.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
